import yygh from '/assets/images/icon_guahao.png'
import ghjl from '/assets/images/icon_guahaojilu.png'
import mzjf from '/assets/images/icon_jiaofei.png'
import bgdj from '/assets/images/icon_danju.png'
import kpcz from '/assets/images/icon_chongzhi.png'
import jyzn from '/assets/images/icon_jiuyizhinan.png'

import { authFn } from '/js/auth'

Page({
  data:{
    list42: [
      {
        icon: yygh,
        text: '预约挂号',
      },
      {
        icon: yygh,
        text: '当日挂号',
      },
      {
        icon: ghjl,
        text: '挂号记录',
      },
      {
        icon: bgdj,
        text: '报告查询',
      },
      {
        icon: mzjf,
        text: '门诊缴费',
      },
      {
        icon: kpcz,
        text: '充值缴费',
      },
      {
        icon: jyzn,
        text: '就医指南',
      },
    ],
  },
  onLoad(query) {
    // 页面加载
    console.info(`Page onLoad with query: ${JSON.stringify(query)}`);
  },
  onReady() {
    // 页面加载完成
  },
  onShow() {
    // 页面显示
  },
  onHide() {
    // 页面隐藏
  },
  onUnload() {
    // 页面被关闭
  },
  onTitleClick() {
    // 标题被点击
  },
  onPullDownRefresh() {
    // 页面被下拉
  },
  onReachBottom() {
    // 页面被拉到底部
  },
  onCardClick(ev) {
   my.alert({
     content: ev.info,
   });
  },

  // 用户实名建档按钮点击事件
  onUserAccountCreateClick(){
      //
      my.getAuthCode({
        scopes: 'auth_user',
        success: ({ authCode }) => {
          // 向后台发送authCode          
          authFn(authCode);
        },
    });
  },
  onShareAppMessage() {
    // 返回自定义分享信息
    return {
      title: 'My App',
      desc: 'My App description',
      path: 'pages/index/index',
    };
  },
});
